import React, { useEffect, useState } from 'react'
import { withCount } from '../hoc/withCount'


const Child1 = (props) => {

  // const [count,setCount] = useState(0)
  // useEffect(() => {
  //   const timer = setInterval(() => {
  //     setCount(prev => prev +1)
  //   },1000)

  //   return () => {
  //     clearInterval(timer)
  //   }

  // },[])


  return (
    <div className='box'>
      <h1>{props.title}</h1>
      <p>定时器:{props.count}</p>
    </div>
  )
}

export default withCount(Child1)